import React from 'react';
import { Routes, Route, Navigate } from 'react-router-dom';

// 页面组件
import HomePage from '../pages/Home';
import LoginPage from '../pages/Login';
import SearchPage from '../pages/Search';
import ProductPage from '../pages/Product';
import ProductListPage from '../pages/ProductList';
import CategoryPage from '../pages/Category';
import CartPage from '../pages/Cart';
import ProfilePage from '../pages/Profile';
import OrderCreatePage from '../pages/Order/Create';
import OrderDetailPage from '../pages/Order/Detail';
import PaymentPage from '../pages/Payment';

const MallRoutes: React.FC = () => {
  return (
    <Routes>
      {/* 主要页面 */}
      <Route path="/" element={<HomePage />} />
      <Route path="/search" element={<SearchPage />} />
      <Route path="/category" element={<CategoryPage />} />
      <Route path="/products" element={<ProductListPage />} />
      <Route path="/product/:id" element={<ProductPage />} />
      <Route path="/cart" element={<CartPage />} />
      <Route path="/profile" element={<ProfilePage />} />
      
      {/* 用户相关 */}
      <Route path="/login" element={<LoginPage />} />
      
      {/* 订单相关 */}
      <Route path="/order/create" element={<OrderCreatePage />} />
      <Route path="/order/:id" element={<OrderDetailPage />} />
      <Route path="/payment/:orderId" element={<PaymentPage />} />
      
      {/* 默认重定向 */}
      <Route path="*" element={<Navigate to="/mall" replace />} />
    </Routes>
  );
};

export default MallRoutes; 